FROM  nvcr.io/nvidia/tritonserver:23.12-py3

LABEL maintainer="Lzc" description="triton serving base image"

RUN echo "deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse" > /etc/apt/sources.list && \
    echo "deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse" >> /etc/apt/sources.list && \
    echo "deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse" >> /etc/apt/sources.list && \
    echo "deb http://security.ubuntu.com/ubuntu/ jammy-security main restricted universe multiverse"  >> /etc/apt/sources.list && \
    apt update

#python
RUN apt-get install python3.10 python3-pip -y

#pip换源
RUN pip3 config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple/
RUN ln -s /usr/bin/python3 /usr/bin/python

#torch and torchvision use inner network
ARG PIP_ARGS="--trusted-host 192.168.2.229 -i http://192.168.2.229/repository/pypi-group/simple --no-cache-dir"
RUN pip3 install --upgrade pip ${PIP_ARGS} && \
    pip3 install torch==2.3.0+cu121 torchvision==0.18.0+cu121 ${PIP_ARGS}
#torch and torchvision use common network
# RUN pip3 install --upgrade pip && \
#     pip3 install torch==2.3.0+cu121 torchvision==0.18.0+cu121 --index-url https://download.pytorch.org/whl/cu121
#torch and torchvision use local files
# ARG torch_file=torch-2.3.0+cu121-cp310-cp310-linux_x86_64.whl
# ARG torchvision_file=torchvision-0.18.0+cu121-cp310-cp310-linux_x86_64.whl
# COPY ${torch_file} /opt
# COPY ${torchvision_file} /opt
# WORKDIR /opt
# RUN pip3 install --upgrade pip && \
#     pip3 install ${torch_file} ${torchvision_file}
# RUN rm ${torch_file} ${torchvision_file}

RUN pip3 install numpy==1.26.4
RUN pip3 install opencv-python-headless
